package de.bazinga.rotw.network;

import com.captiveimagination.jgn.event.MessageListener;
import com.captiveimagination.jgn.message.Message;

import de.bazinga.rotw.game.RotwGameState;
import de.bazinga.rotw.network.message.GameMessage;

public class ClientMessageListener implements MessageListener {
	
	private RotwGameState game = null;
	
	public ClientMessageListener(RotwGameState game) {
		this.game = game;
	}
	
	public void messageCertified(Message message) {
        //System.out.println("Message Certified: " + message);
    }

    public void messageFailed(Message message) {
        System.out.println("Message Failed: " + message);
    }

    public void messageReceived(Message message) {
        //System.out.println("Message Received: " + message);
        
        if(message instanceof GameMessage) {
        	((GameMessage) message).handleMessage(game, message, false);
        }
    }

    public void messageSent(Message message) {
        //System.out.println("Message Sent: " + message);
    }
}
